﻿using ConsoleHoster.Common.Utilities;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Media;

namespace ConsoleHoster.Common.UnitTests
{
	[TestClass]
	public class FontFamiliesProviderTests
	{
		[TestMethod]
		public void GetAvailableFontFamilies_ReturnsExpectedResults()
		{
			FontFamiliesProvider tmpProvider = new FontFamiliesProvider();

			ReadOnlyCollection<FontFamily> tmpActualResult = tmpProvider.GetAvailableFontFamilies();

			IList<FontFamily> tmpExpectedResult = Fonts.SystemFontFamilies.Where(item => !item.Source.ToLower().Contains(FontFamiliesProvider.EXCLUDED_FONT_NAME)).ToList();

			Assert.AreEqual(tmpExpectedResult.Count(), tmpActualResult.Count(), "UnexpectedNumberOfFonts");
			Assert.IsTrue(tmpExpectedResult.All(item => tmpActualResult.Contains(item)));
		}
	}
}
